package tech.aistar.corejava.day09;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:
 * @date 2019/7/25 0025
 */
public class EqualsStudentDemo {
    public static void main(String[] args) {
        Student s1 = new Student(1,"1001");
        Student s2 = new Student(1,"1001");

        System.out.println(s1 == s2);//false

        System.out.println(s1.equals(s2));//false - 没有重写equals之前

        System.out.println(s1.equals(null));//false

        System.out.println(s1.equals(s1));//true

        System.out.println(s1.equals("abc"));

        System.out.println("===============");

        System.out.println(s1.equals(s2));

        System.out.println(s1 == s2);

        //如果equals返回true,那么hascode()的值是一样的.
        System.out.println(s1.hashCode());//哈希值

        System.out.println(s2.hashCode());//哈希值
    }
}
